package sceneGraph;

import com.sun.opengl.util.texture.Texture;
import com.sun.opengl.util.texture.TextureIO;

public class SkyBox implements ISceneObject {

	private Texture front;
	private Texture back;
	private Texture left;
	private Texture right;
	private Texture top;
	private Texture bottom;

	private float factor;

	private Camera camera;

	@Override
	public void accept(Visitor visitor) {
		visitor.visit(this);
	}

	public SkyBox(Camera camera) {
		factor = 1000f;
		this.camera = camera;

		try {
			String dir = "/images/skybox/";
			front = TextureIO.newTexture(getClass().getResourceAsStream(dir + "front.jpg"), true, null);
			back = TextureIO.newTexture(getClass().getResourceAsStream(dir + "back.jpg"), true, null);
			left = TextureIO.newTexture(getClass().getResourceAsStream(dir + "left.jpg"), true, null);
			right = TextureIO.newTexture(getClass().getResourceAsStream(dir + "right.jpg"), true, null);
			top = TextureIO.newTexture(getClass().getResourceAsStream(dir + "top.jpg"), true, null);
			bottom = TextureIO.newTexture(getClass().getResourceAsStream(dir + "bottom.jpg"), true, null);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public float getFactor() {
		return factor;
	}

	public Camera getCamera() {
		return camera;
	}

	public Texture getFrontTexture() {
		return front;
	}

	public Texture getBackTexture() {
		return back;
	}

	public Texture getLeftTexture() {
		return left;
	}

	public Texture getRightTexture() {
		return right;
	}

	public Texture getTopTexture() {
		return top;
	}

	public Texture getBottomTexture() {
		return bottom;
	}
}
